home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10379 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.2 KB

  1. Path: news.PBI.net!usenet
  2. From: mich@pbinet.com
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What dose a DLL file do?
  5. Date: 17 Mar 1996 06:04:04 GMT
  6. Organization: Pacific Bell Internet Services
  7. Message-ID: <4iga0k$qpa@SNFC21_SRVR_WWW.PBI.net>
  8. References: <4h8b73$7ua@coranto.ucs.mun.ca> <4hagaf$9id@dewey.csun.edu>
  9. Reply-To: mich@pbinet.com
  10. NNTP-Posting-Host: ppp-5-2.rdcy01.pbinet.com
  11. X-Newsreader: IBM NewsReader/2 v1.03
  12.  
  13. In <4hagaf$9id@dewey.csun.edu>, hbmus009@csun.edu (christopher johnson) writes:
  14. >Matthew Smyth (ybf1037@InfoNET.st-johns.nf.ca) wrote:
  15. >>     I was wondering what exactly dose a DLL file do?
  16. >
  17. >DLL stands for Dynamic Link Library.  These are a special kind of library
  18. >that doesn't get statically linked into your programs.  The final linking
  19. >process happens when you execute a program that will make use of a
  20. >particular DLL.  Ok, that didn't make a lot of sense to anyone that
  21. >doesn't know what a DLL is in the first place.  Let me try again.
  22.  
  23. DLL Fundamentals.
  24.  
  25. A dll (or shared object in unix) is a collection of routines that is available to any
  26. program that wants to use it. UNIX, Windows, OS/2, and any intelligent os uses
  27. shared libraries. 
  28. You can link to such a library either statically or dynamically. There are 
  29. benes and bad points about either method. 
  30. A shared lib is good in any case becuase a well planned one can provide a number
  31. of functions to a number of execution level programs at minimum memory cost.
  32. Thats why you use them.
  33. A good example of a dll is one that provides low level i/o services to a terminal
  34. emulator. Opening the i/o port, sending a byte OR a block to the port, and closing
  35. the port are all separate functions that you might find in a dll that comes with
  36. a term program. 
  37. A better example might be a dll that handles disk i/o. There would be separate
  38. functions that open a file, position the head, and write a byte or a block, check
  39. the crc for a block, write permissions, and close the file, and the functions from
  40. this one object are available to any program that needs to use them. 
  41. If you have a mail reader, the operating system, and say a disk editor loaded in
  42. memory doing what they do, they are all using one library. Much more efficient
  43. than them all having thier own routines taking up that much more memory.
  44. Static linking to such a library is when you include that libraries '.lib' file in your
  45. project or make file. The entry points for dll (or lib) functions are resolved for you
  46. at compile time and a map of these points is reserved in part of your executable's
  47. data space for all time. No muss, no fuss. This is the easy route (as far as the
  48. programmer is concerned.) They cannot change, they are static.
  49. Dynamic linking is when the entry points are resolved at runtime, thus they are
  50. dynamic. You have to do some extra coding. A function must be called that actually
  51. searches for the entry point in the library, loads it, then a another function must be 
  52. called to execute the exported function in the object, then another function must be
  53. called to clean up the mess caused by the previous process, which incures a slight
  54. lag in execution. But the savings in memory is great. 
  55. Functions that are used dynamically have the greatest memory saving. Windows
  56. (and all the other modern os's) are a collection of dll's.
  57. Ok, I'll get off my pulpit now.
  58.  
  59.